package com.kuanrf.commons.excel.test;

import com.kuanrf.commons.excel.exception.ExcelContentInvalidException;
import com.kuanrf.commons.excel.extension.ExcelRule;

public class MyStringCheckRule implements ExcelRule<String> {

	public void check(Object value, String columnName, String fieldName) throws ExcelContentInvalidException {
		String val = (String) value;
		System.out.println("-------->   检测的列名为  " + columnName + "， 填充的字段名为 " + fieldName );
		if(val.length() > 10){
			throw new ExcelContentInvalidException("内容超长!");
		}
	}

	public String filter(Object value, String columnName, String fieldName) {
		String val = (String) value;
		return "[[[[" + val + "]]]";
	}

}
